#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

class Node_t {
public:
    Node_t();
    Node_t(int data):val(data){}
    int val;
    vector<Node_t *> child;
};


Node_t *readTree(ifstream &in)
{
    char ch;
	if (in.eof()) return NULL;
	in >> ch;
    if (ch == '#') {
        return NULL;
    }

    Node_t *root = new Node_t(ch-'a'+1);
    while (1) {
		Node_t *child = readTree(in);
        if (child != NULL)
			root->child.push_back(child);
        else
			break;
    }
	return root;
}

int main(int argc, char **argv)
{
    ifstream in("tree.out");
    Node_t *root = NULL;
    root = readTree(in);
    in.close();
}
